package com.ilong.provider.controller;

import org.ilong.commons.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * TOOD
 *
 * @author long
 * @date 2020-07-21 15:47
 */
@RestController
public class HelloController {

    @Value("${server.port}")
    Integer port;


    @GetMapping("/hello")
    public String hello(){
        return "hello world:"+port;
    }

    @GetMapping("/hello2")
    public String hello2(String name){
       return "hello"+name;

    }

    @PostMapping("/user1")
    public User addUser1(User user){
        return user;
    }

    @PostMapping("/user2")
    public User addUser2(@RequestBody User user){
        return user;
    }


}
